package com.yaoxun.bored.model.sys.menu;

import javax.persistence.Column;
import javax.persistence.Table;

import com.yaoxun.bored.util.enums.MenuLeaf;

@Table(name="b_menu")
public class MenuTree {
	
	@Column(name="menu_id")
	private Integer id;
	
	@Column(name="menu_name")
	private String name; //对应表menu_name
	
	@Column(name="parent_id")
	private Integer pid;
	
	private Integer leaf; //是否叶子

	//根据pojo生成parentId属性，为了便于在Ztree中传递参数
	public Integer getParentId() {
		return this.id;
	}
	//根据pojo生成isParent属性，便于zTree使用
	public boolean getIsParent() {
		if(this.leaf.intValue() == MenuLeaf.NO_LEAF.value()) {
			return true;
		}else {
			return false;
		}
	}
	
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getPid() {
		return pid;
	}

	public void setPid(Integer pid) {
		this.pid = pid;
	}

	public Integer getLeaf() {
		return leaf;
	}

	public void setLeaf(Integer leaf) {
		this.leaf = leaf;
	}

	@Override
	public String toString() {
		return "MenuTree [id=" + id + ", name=" + name + ", pid=" + pid + ", leaf=" + leaf + "]";
	}
	
}
